<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" href="Public/Css/style.css" />
		<link rel="stylesheet" href="Public/Css/validform.css" />
		<link rel="stylesheet" href="Public/Css/uploadify.css" />
		<link rel="stylesheet" href="Public/Css/imgareaselect-animated.css" />
		<title>register page</title>
	</head>
	<body>
		<fieldset class="reg_fieldset">
			<legend>register</legend>
			<div>
				<form class="reg_form" action="zkf_tool?s=reg_form" method="post">
					<input type="hidden" name="lock" value="<?=md5('zkf'.md5(ZKF::time()))?>" />
					<input type="hidden" name="lockey" value="<?=md5(ZKF::time())?>" />
					<div class="reg_div"><label class="reg_label">username：</label><input class="reg_input" type="text" name="username" value="aaaa"/><span class="Validform_checktip"></span></div>
					<div class="reg_div"><label class="reg_label">password：</label><input class="reg_input" type="password" name="password"  value="aaaqqq"/><span class="Validform_checktip"></span></div>
					<div class="reg_div"><label class="reg_label">password1：</label><input class="reg_input" type="password" name="password1"  value="aaaqqq"/><span class="Validform_checktip"></span></div>
					<div class="reg_div"><label class="reg_label">email：</label><input class="reg_input" type="text" name="email"  value="aaa@qq.cmn"/><span class="Validform_checktip"></span></div>
					<div class="reg_div">
						<label class="reg_label">photo：</label>
						<input id="files" class="reg_files" type="file" name="files" />
						<input id="photo" type="hidden" name="photo" value=""/>
						<span class="Validform_checktip"></span>
					</div>
					<div class="reg_div regpic">
						<img class="reg_photo" src="Public/Image/default_user_photo.gif"/>
						<input type="hidden" name="x1" class="reg_point"/>
						<input type="hidden" name="y1" class="reg_point"/>
						<input type="hidden" name="x2" class="reg_point"/>
						<input type="hidden" name="y2" class="reg_point"/>
						<span class="Validform_checktip"></span>
					</div>
					<div class="reg_div"><label class="reg_label">intro：</label><textarea class="reg_input" name="intro" >aaa</textarea><span class="Validform_checktip"></span></div>
					<div class="reg_div">
						<label class="reg_label">verify：</label>
						<input class="reg_input_verify" type="text" name="verify" />
						<img class="reg_verify" s="verify" src="zkf_tool?s=verify" />
						<span><a class="reg_verify_text" s="verify" href="javascript:void(0);">看不清楚？點擊更換</a></span>
						<span class="Validform_checktip"></span>
					</div>
					<div class="reg_div"><input class="reg_submit" type="submit" value="submit" /><input class="reg_reset" type="reset" value="reset"/></div>
				</form>
			</div>
		</fieldset>
		
<script type="text/javascript" src="Public/Js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="Public/Js/Validform_v5.3.2_min.js"></script>
<script type="text/javascript" src="Public/Js/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="Public/Js/jquery.imgareaselect.min.js"></script>

<script type="text/javascript">
$(function(){
	var vf = $(".reg_form").Validform({
		tiptype:3,
		postonce:true,
		label:".reg_label",
		datatype:{"int": /^[123456789]{1}\d*?$/ },
		ajaxPost:true,
		callback:function(data){
			if(data.status=="y"){
				setTimeout(function(){
					$.Hidemsg();//公用方法关闭信息提示框;显示方法是$.Showmsg("message goes here.");
					window.location.href="login.php"; 
				},2000);
			}
		}
	});
	vf.addRule([{
		ele:"[name='username']",
		datatype:"s4-10",
		ajaxurl:"zkf_tool?s=reg_check_username",//返回json的info會替換msg顯示,status為通過與否
		nullmsg:"用户名不能为空！",
		errormsg:"请填写4-10位字符！",
		sucmsg:' ',
	},{
		ele:"[name='password']",
		datatype:"*6-15",
		nullmsg:"密码不能为空！",
		errormsg:"密码范围在6~15位之间！",
		sucmsg:' '
	},{
		ele:"[name='password1']",
		datatype:"*6-20",
		recheck:"password",
		nullmsg:"请重新输入密码！",
		errormsg:"重新输入密码错误！",
		sucmsg:' ',
	},{
		ele:"[name='email']",
		datatype:"e",
		nullmsg:"请输入邮箱，例如：xxx@xx.xxx",
		errormsg:"邮箱格式有误！",
		sucmsg:' ',
	},{
		ele:"[name='photo']",
		datatype:"*",
		nullmsg:"请上传头像！",
		sucmsg:' ',
	},{
		ele:"[name='intro']",
		datatype:"*",
		nullmsg:"請輸入個人簡介！",
		errormsg:"請輸入個人簡介！",
		sucmsg:' ',
	},{
		ele:"[name='verify']",
		datatype:"s1-6",
		ajaxurl:"zkf_tool?s=check_verify",
		nullmsg:"請輸入驗證碼！",
		errormsg:"驗證碼錯誤！",
		sucmsg:' ',
	}]);
	/////////////////////////////////////////
	 var ias= $('.reg_photo').imgAreaSelect({
		aspectRatio: '1:1',
		instance: true,
//		handles: true,
//		x1: 20,
//		y1: 20,
//		x2: 150,
//		y2: 150,
		onSelectEnd : function (img, selection) {
			$("[name='x1']").val(selection.x1);
			$("[name='y1']").val(selection.y1);
			$("[name='x2']").val(selection.x2);
			$("[name='y2']").val(selection.y2);
	    }
	});
			
	////////////////////////////////////////
	$("#files").uploadify({
		//'formData'     : {'k':'v'},
		//'fileSizeLimit' : '100KB',
		'multi'    : false,
        'fileTypeDesc' : 'Image Files',
        'fileTypeExts' : '*.gif; *.jpg; *.png', 
		'uploader' : 'zkf_tool?s=reg_upload',
		'onUploadSuccess' : function(file,data,response) {
           $('.reg_photo').attr("src",data);
           $('#photo').val(data);
           ias.cancelSelection();
           $('.reg_point').val('');
        }
	});

	///////////////////////////////////////
	$("[s='verify']").click(function(){
		$(".reg_verify").attr('src','zkf_tool?s=verify&'+Math.random());
	});
});
</script>
	</body>
</html>